<template>
  <div class="outer">
    <circle-img class="avatar" :src="src" />
    <div class="bubbleItem">
      <span class="bubble leftBubble">
        {{message.msgContent}}
        <span class="bottomLevel"></span>
        <span class="topLevel"></span>
      </span>
    </div>
  </div>
</template>

<script>
import CircleImg from '../common/CircleImg'

export default {
  name: 'LeftBubble',
  components: {
    CircleImg
  },
  props: {
    message: Object,
    src: String
  },
  data () {
    return {
      visible: false
    }
  },
  mounted () {
    this.visible = true
  }
}
</script>

<style lang="stylus" scoped>
.outer {
  text-align: left;
  margin: 10px 0 30px 20px;

  .avatar {
    width: 60px;
    height: 60px;
    display: inline-block;
    vertical-align: top;
  }
}

// 气泡样式
.bubbleItem {
  display: inline-block;
  margin-top: 25px;
}

.bubble {
  float: left;
  max-width: 300px;
  word-wrap: break-word;
  position: relative;
  line-height: 40px;
  min-height: 40px;
  padding: 5px 20px 5px 20px;
  border-radius: 7px;
}

.leftBubble {
  position: relative;
  margin-left: 25px;
  border: 1px solid #f7f4e3;
  background-color: #f7f4e3;
}

.bottomLevel {
  position: absolute;
  top: 10px;
  left: -10px;
  border-top: 10px solid #f7f4e3;
  border-left: 10px solid transparent;
}

.topLevel {
  position: absolute;
  top: 11px;
  left: -8px;
  border-top: 10px solid #f7f4e3;
  border-left: 10px solid transparent;
}
</style>
